package labox.innovation.gameserver.skills.conditions;

import labox.innovation.gameserver.model.actor.L2Character;
import labox.innovation.gameserver.model.actor.instance.FuzeMonsterInstance;
import labox.innovation.gameserver.model.actor.instance.FuzePcInstance;
import labox.innovation.gameserver.skills.Env;

/**
 * @author mkizub
 * 
 *         TODO To change the template for this generated type comment go to
 *         Window - Preferences - Java - Code Style - Code Templates
 */
public class ConditionTargetAggro extends Condition {

	private final boolean _isAggro;

	public ConditionTargetAggro(boolean isAggro) {
		_isAggro = isAggro;
	}

	@Override
	public boolean testImpl(Env env) {
		L2Character target = env.target;
		if (target instanceof FuzeMonsterInstance) {
			return ((FuzeMonsterInstance) target).isAggressive() == _isAggro;
		}
		if (target instanceof FuzePcInstance) {
			return ((FuzePcInstance) target).getKarma() > 0;
		}
		return false;
	}
}
